<template>
  <div class="fixed">
    <div class="top">
      <span @click="close">
        <svg-icon icon-class="back" class="icon" />
      </span>
      <span>银行卡</span>
      <span class="link">添加银行卡</span>
    </div>
    <div
      v-for="card in list"
      :key="card.id"
      class="card"
      :style="{ backgroundImage: `url(${card.img})` }"
      @click="close(card)"
    >
      <p class="num">
        卡号<br /><em>**** **** **** {{ card.num }}</em>
      </p>
      <div class="info">
        <span>
          发行银行<br /><em>{{ card.title }}</em>
        </span>
        <span>储蓄卡</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          id: 1,
          name: "jh",
          title: "中国建设银行",
          num: "0101",
          img: require("../../assets/images/jh_bg.png")
        },
        {
          id: 2,
          name: "gh",
          title: "中国工商银行",
          num: "2222",
          img: require("../../assets/images/gh_bg.png")
        },
        {
          id: 3,
          name: "pa",
          title: "中国平安银行",
          num: "1010",
          img: require("../../assets/images/pa_bg.png")
        }
      ]
    };
  },
  methods: {
    close(item) {
      this.$emit("close", item);
    }
  }
};
</script>
